import { Component } from '@angular/core';
import { Od } from './od';
import {SelectItem} from 'primeng/api';

@Component({
  selector: 'ngx-overdraftinfo',
  styleUrls: ['overdraftinfo.component.scss'],
  templateUrl: 'overdraftinfo.component.html',
})
export class OverdraftinfoComponent {

  ods: Od[] = [
    { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
    { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
    { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
    { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
    { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
    { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
    { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'}
  ]

  cols: any[] = [
    { field: 'odName', header: '超采区名称' },
    { field: 'adNm', header: '地级行政区' },
    { field: 'total', header: '超采区总面积(km³)' },
    { field: 'bad', header: '严重超采区面积(km³)' },
    { field: 'normal', header: '一般超采区面积(km³)' },
    { field: 'problem', header: '生态与环境地质问题' },
  ];

  types: SelectItem[];

  selectedType: string[] = ['1'];

  constructor() {
    this.types = [
      {label: '浅层地下水超采区', value: '1'},
      {label: '深层承压水超采区', value: '2'}
    ];
  }

  handleChange(e) {
    if(e.value==2){
      this.ods = [
        { odName: '大同市地下水超采区1', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
        { odName: '大同市地下水超采区1', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
        { odName: '大同市地下水超采区1', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
        { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
        { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
        { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
        { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'}
      ]
    }
    if(e.value==1){
      this.ods = [
        { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
        { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
        { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
        { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
        { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
        { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'},
        { odName: '大同市地下水超采区', adNm: '大同',total: '2033.76',bad:'1015.80',normal: '1017.96',problem:'水位下降、咸水入侵'}
      ]
    }
  }
}
